package one_to_one.un_un.to.un_un;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;

@Entity
@TableGenerator(name = "personne_gen")
public class Personne implements Serializable {

	private static final long serialVersionUID = 3145477371597757329L;

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "personne_gen")
	@Column(nullable = false, unique = true)
	private Long idPersonne;

	@Column(nullable = false, unique = false)
	private String nom;

	@Column(nullable = false, unique = false)
	private int age;

	@Embedded
	@AttributeOverrides({
			@AttributeOverride(name = "poids", column = @Column(name = "poids_coeur")),
			@AttributeOverride(name = "debit", column = @Column(name = "debit_coeur")) })
	private Coeur coeur;

	public Personne() {
	}

	public Personne(String nom, int age) {
		this.nom = nom;
		this.age = age;
	}

	public Long getIdPersonne() {
		return idPersonne;
	}

	public void setIdPersonne(Long idPersonne) {
		this.idPersonne = idPersonne;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Coeur getCoeur() {
		return coeur;
	}

	public void setCoeur(Coeur coeur) {
		this.coeur = coeur;
	}

	@Override
	public String toString() {
		return "Personne [idPersonne=" + idPersonne + ", nom=" + nom + ", age="
				+ age + ", coeur=" + coeur + "]";
	}
}
